//
//  MTLuckyAPI.swift
//  MT
//
//  Created by ooops on 2020/1/21.
//  Copyright © 2020 张强. All rights reserved.
//

import Foundation

/// 网络
import Moya
import DeviceKit
import SwiftyRSA
import Security

import Result

enum MTLuckyAPI {
    /// 奖品数组
    case list
    /// 抽奖接口
    case lottery
    /// 中奖报告
    case report
    
}


// MARK: ------------------ Api 参数 ----------------------
extension MTLuckyAPI: MTTargetType {

    /// 请求头
    public var headers: [String : String]? {
        guard let accessToken = UserDefaults.MTUserCenter.token.storedString else { return nil }
        return ["Access-Token": accessToken]
    }
    
    /// 基路径
    public var baseURL: URL {
        return URL(string: AuthServerBaseUrl)!
    }
    
    /// 路径
    public var path: String {
        switch self {
            /// 抽奖
        case .list:
            return "/lottery/list"
        case .lottery:
            return "/lottery/lottery"
        case .report:
            return "/lottery/report"
        }
    }
    
    /// 请求方法
    public var method: Moya.Method {
        return .post
    }
    
    /// 参数
    var params: [String: Any]? {
        
        switch self {
            /// 抽奖列表
        case .list, .lottery, .report:
            return nil
        }
        
    }
    
}

